<body>
	<div class="pad-10">
		<div class="content-menu ib-a blue line-x">
			<a class="add fb" href="javascript:;"
				onclick="javascript:openwinx('/Goods/add/','添加内容')"><em>添加商品</em></a>
		</div>
		<div id="searchid">
			<form name="searchform" action="/content/manage/search/"
				method="post">
				<table width="100%" cellspacing="0" class="search-form">
					<tbody>
						<tr>
							<td>
								<div class="explain-col">
									添加时间： <input type="text" name="start_time" id="start_time"
										value="" size="10" class="date" readonly>&nbsp; -
									&nbsp;<input type="text" name="end_time" id="end_time" value=""
										size="10" class="date" readonly>&nbsp;商品分类：<select
										name="cid" id="cid"><option value='' selected>请选择分类</option>
										<?php echo $select_categorys ?>
									</select>&nbsp; 首页显示：<select name="is_index" id="is_index"><option
											value='' selected>全部</option>
										<option value="1">是</option>
										<option value="0">否</option>
									</select>&nbsp; <select name="searchtype" id="searchtype">
										<option value='1' selected>标题</option>
										<option value='2'>用户名</option>
										<option value='3'>ID</option>
									</select>&nbsp; <input name="keyword" id="keyword" type="text" value=""
										class="input-text" /> <input type="button" name="dosearch" f
										class="button" onclick="Search()" value="搜索" />
								</div>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<div id="content_list">
			<form name="myform" id="myform" action="" method="post">
				<div class="table-list">
					<table width="100%">
						<thead>
							<tr>
								<th width="16"><input type="checkbox" value=""
									id="check_box" onclick="selectall('ids[]');"></th>
								<th width="40">ID</th>
								<th width="40"></th>
								<th>商品名称</th>
								<th width="80">商品分类</th>
								<th width="80">品牌分类</th>
								<th width="40">来源</th>
								<th width="60">原价格(元)</th>
								<th width="60">价格(元)</th>
								<th width="40">喜欢</th>
								<th width="70">人气</th>
								<th width="118">更新时间</th>
								<th width="72">管理操作</th>
							</tr>
						</thead>
						<tbody>
							<?php
								if(!empty($list)){
						  		foreach ($list as $val) { 
							?>
							<tr>
								<td align="center"><input class="inputcheckbox "
									name="ids[]" value="<?php echo $val['Goods']['id'] ?>"
									type="checkbox"></td>
								<td align='center'>
									<?php echo $val['Goods']['id'] ?>
								</td>
								<td align='right'>
									<img width="35" width="35" title="" class="preview" bimg="<?php echo Configure::read('admin_config.mainDomain'); ?><?php echo $val['Goods']['img'] ?>" src="<?php echo Configure::read('admin_config.mainDomain'); ?><?php echo $val['Goods']['img_80'] ?>">
								</td>
								<td><a href="javascript:;"
									onclick="javascript:openwinx('/Goods/edit/<?php echo $val['Goods']['id'] ?>/','')">
										<span style=""> <?php echo $val['Goods']['title'] ?>
									</span>
								</a> <?php if($val['Goods']['img']) { ?> <img title="缩略图"
									src="/img/icon/small_img.gif"> <?php } ?></td>
								<td align='center'>
									<?php echo $val['Goods']['cate_name'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['bid_name'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['sid_img'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['old_price'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['price'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['hits'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['hits'] ?>
								</td>
								<td align='center'>
									<?php echo $val['Goods']['ctime'] ?>
								</td>
								<td align='center'><a href="javascript:;"
									onclick="javascript:openwinx('/Goods/edit/<?php echo $val['Goods']['id'] ?>/','编辑内容')">修改</a>
									| <a
									href="javascript:view_comment('<?php echo $val['Goods']['id'] ?>','<?php echo $val['Goods']['title'] ?>')">评论</a>
								</td>
							</tr>
							<?php } } ?>
						</tbody>
					</table>
					<div class="btn">
						<input type="button" class="button" value="删除" />
					</div>
					<div id="pages">
						<?php echo $this->Page->show($perpage, $total, $curpage, 10, '/Goods/index/cid:' . $cid . '/is_index:' . $is_index . '/searchtype:' . $searchtype . '/keyword:' . $keyword . '/start_time:' . $start_time . '/end_time:' . $end_time . '/page:', 2 .'/'); ?>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
<SCRIPT>
	//删除新闻
	function confirm_delete() {
		window.top.art.dialog({
			content : '确认删除吗？',
			ok : function() {
				myform.submit();
				return true;
			},
			canceVal : '取消',
			cancel : true
		});
	}

	//查看评论
	function view_comment(id, name) {
		window.top.art.dialog.open('/Content/comment/' + id + '/', {
			yesText : '关闭',
			title : '查看评论：' + name,
			id : 'view_comment',
			width : 800,
			height : 500,
			lock : true
		});
	}

	function refersh_window() {
		var refersh_time = $.cookie('refersh_time');
		if (refersh_time == 1) {
			window.location.reload();
		}
	}

	$(document).ready(function() {
		window.top.$('#display_center_id').css('display', 'none');
		
		$(".preview").preview();
		
		Calendar.setup({
			weekNumbers : false,
			inputField : "start_time",
			trigger : "start_time",
			dateFormat : "%Y-%m-%d",
			showTime : false,
			minuteStep : 1,
			onSelect : function() {
				this.hide();
			}
		});

		Calendar.setup({
			weekNumbers : false,
			inputField : "end_time",
			trigger : "end_time",
			dateFormat : "%Y-%m-%d",
			showTime : false,
			minuteStep : 1,
			onSelect : function() {
				this.hide();
			}
		});
	});

	//搜索
	function Search() {
		url = '/Goods/index/';
		url += 'cid:' + $('#cid').val() + '/';
		url += 'is_index:' + $('#is_index').val() + '/';
		url += 'searchtype:' + $('#searchtype').val() + '/';
		url += 'keyword:' + $('#keyword').val() + '/';
		url += 'start_time:' + $('#start_time').val() + '/';
		url += 'end_time:' + $('#end_time').val() + '/';

		window.location.href = url;
	};
</SCRIPT>